<?php
class Model_DbTable_ProductCategoryImage extends Apps_Db_Table_Abstract {
	protected $_name = 'product_category_image';

	const STATUS_ACTIVE   = 1;
	const STATUS_INACTIVE = 0;
	const STATUS_DELETED  = -1;

	public function listByProductId($productId) {
		$q = $this->_db
				  ->select()
				  ->from($this->_name, null)
				  ->where('status =?', self::STATUS_ACTIVE)
				  ->where('product_category_id =?', $productId)
				  ->order($this->_name . '.sorting_number')
				  ->columns(array('id'			    => 'id',
				 				  'path'	        => 'path',
				 				  'sorting_number'	=> 'sorting_number',
				  				  'created_date'    => 'created_date'));

 		return $q->query()->fetchAll();
	}


}